import moment from 'moment'

const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'
const DATE_FORMAT = 'YYYY-MM-DD '

// formatToDateTime 时间格式化 Y-M-D H:m:s
export function formatToDateTime(
  date: moment.MomentInput = undefined,
  format = DATE_TIME_FORMAT
): string {
  return moment(date).format(format)
}

// formatToDate 时间格式化 Y-M-D
export function formatToDate(date: moment.MomentInput = undefined): string {
  return moment(date).format(DATE_FORMAT)
}
